package com.bt.lms.ui.page.common.action.pagecommon;

import com.bt.lms.ui.page.common.PageSys;
import com.bt.lms.ui.vo.PageSkipInfo;
import javafx.collections.ObservableList;
import javafx.event.EventHandler;
import javafx.scene.Node;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.Pane;

/**
 * 系统管理标签的事件
 */
public class SysLabAction implements EventHandler<MouseEvent> {

    /**
     * 界面跳转数据
     */
    private final PageSkipInfo pageSkipInfo;

    /**
     * 构造事件
     * @param pageSkipInfo 界面跳转数据
     */
    public SysLabAction(PageSkipInfo pageSkipInfo) {
        this.pageSkipInfo = pageSkipInfo;
    }

    /**
     * 事件实现
     * @param event the event which occurred
     */
    @Override
    public void handle(MouseEvent event) {

        Pane pane = pageSkipInfo.getPane();
        Integer index = pageSkipInfo.getIndex();

        PageSys pageSys = new PageSys();

        ObservableList<Node> children = pane.getChildren();
        children.set(index, pageSys);

    }
}
